import junit.framework.TestCase;
import junit.framework.TestSuite;


public class CalculationTest extends TestCase {
	private Calculation calcEngine;


	public CalculationTest(String name) {
		super(name);
		calcEngine = new Calculation();
	}

	protected void setUp() throws Exception {
		super.setUp();
	}

	protected void tearDown() throws Exception {
		super.tearDown();
	}

	
	public final void testAdd() {
		assertEquals(calcEngine.add(20,30), 50);
	}

	public final void testSubtract() {
		assertEquals(calcEngine.subtract(60, 30), 30);
	}

	public final void testMultiply() {
		assertEquals(calcEngine.multiply(100, 3), 300);
	}

	public final void testDivide() {
		assertEquals(calcEngine.divide(333, 3), 111);
		try {

			assertEquals(calcEngine.divide(100, 0), 20);

			} catch (Exception e) {

			// Exception is expected so asserting for true.

			assertTrue(true);

			}
	}
	public static void main(String[] args) {

		junit.textui.TestRunner.run(CalculationTest.suite());

		}

		private static TestSuite suite() {

		TestSuite suite = new TestSuite("Test for Engine.Calculation.java");

		//$JUnit-BEGIN$

		suite.addTestSuite(CalculationTest.class);

		//$JUnit-END$

		return suite;

		}

}
